<?php

namespace app\models;

use Yii;
use yii\behaviors\TimestampBehavior;

/**
 * This is the model class for table "{{%link}}".
 *
 * @property integer $id
 * @property integer $type
 * @property string $title
 * @property string $url
 * @property integer $logo
 * @property string $description
 * @property integer $sort
 * @property integer $hits
 * @property integer $created_at
 * @property integer $updated_at
 * @property integer $status
 */
class Link extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%link}}';
    }

    public function behaviors()
    {
        return [
            TimestampBehavior::className()
        ];
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['type', 'logo', 'sort', 'hits', 'status'], 'integer'],
            [['title', 'url'], 'required'],
            [['title'], 'string', 'max' => 80],
            [['url', 'description'], 'string', 'max' => 128],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'type' => '链接类型',
            'title' => '标题',
            'url' => '网址',
            'logo' => 'Logo',
            'description' => '描述',
            'sort' => '排序',
            'hits' => '点击',
            'created_at' => '添加时间',
            'updated_at' => '更新时间',
            'status' => '状态',
        ];
    }
}
